//
//  WKBottomView.m
//  HaiGeEr_Student
//
//  Created by liuchen on 2018/9/10.
//  Copyright © 2018年 海格尔. All rights reserved.
//

#import "WKBottomView.h"

@implementation WKBottomView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

#pragma mark ==========创建视图==========
- (void)createSubView{
    UIButton *collectBtn = [self returnButtonWithImageName:@"1-2-3" WithSelectImageName:@"1-2-4" WithTitle:@"收藏"];
    collectBtn.frame = CGRectMake(0, 0, self.frame.size.width/5.0, self.frame.size.height);
    _collectBtn = collectBtn;
    [self addSubview:self.collectBtn];
    UIButton *praisesBtn = [self returnButtonWithImageName:@"1-2-6" WithSelectImageName:@"1-2-5" WithTitle:@"点赞"];
    praisesBtn.frame = CGRectMake(self.frame.size.width/5.0*4.0, 0, self.frame.size.width/5.0, self.frame.size.height);
    _praisesBtn = praisesBtn;
    [self addSubview:self.praisesBtn];
}

- (UIButton *)returnButtonWithImageName:(NSString *)imageName WithSelectImageName:(NSString *)selectImageName WithTitle:(NSString *)title{
    float imageSize = 35*SCALEUNIT;
    float intervalSize = 8*SCALEUNIT;
    float buttonWidth = self.frame.size.width/5.0;
    float buttonHeight = self.frame.size.height;
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setTitleColor:RGBA(88, 88, 88, 1) forState:UIControlStateNormal];
    [btn.titleLabel setFont:[UIFont systemFontOfSize:LoginFont-2]];
    [btn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
   // [btn setTitleEdgeInsets:UIEdgeInsetsMake(intervalSize, buttonWidth/2.0+intervalSize,intervalSize,intervalSize)];
    [btn setImageEdgeInsets:UIEdgeInsetsMake((buttonHeight-imageSize)/2.0, buttonWidth/2-imageSize-intervalSize, (buttonHeight-imageSize)/2.0, buttonWidth/2.0+intervalSize)];
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    return btn;
}




@end
